basic working code

basic functions implemented