Tablet version of the code added

Refractored the entire code