Updated code and added more comments. Also added override annotations