initial commit, code draft

need to test and bug fixing