Functionality implemented - needs clean up into different files