In Medieval times, warships had a single deck, with raised structures (the "forecastle" and "aftercastle") at each end. Following the introduction of cannon, the aftercastle was gradually replaced with a simpler structure consisting of the halfdeck above the main deck, extending forwards from the stern to the mainmast; and above that the quarterdeck, extending about half as far forwards. Later the halfdeck was extended the entire length of the ship, becoming the main deck (the former main deck now being the gun deck), leaving the quarterdeck as the only significant deck above the main deck.