third commit, ot almost all functionality working