cleaned up code for mobile