merge working code into master branch