Implemented CAS storage for user data

swap if/else branches