Added submit and flag functionality; added DB/server hooks