restructure code and started implement player functionalities