now has some errors, working on it