All working code without implementing the database and other stuff