comments added and code working