code so far now moved over completely