More input validation implemented. More comments