Removed wasteful codes
Fixed a bug
Added button swaping
Removed debug code