Added error statements
Fixed lazy programming