Pong mechanism added
Added comments and re-organized codes