Clean up code and implements $unset