seperated code into "version2", isolated differerent functions