Add comments and clean code