first commit, all working and semi-working code