many bugs but basic functions implemented