refactor, still needs lots of improvement