Restructured code for better organization
Added robust error detection
Wrote examples for item selection