First commit of semi-working version