still refactoring, mostly works now though
refactoring...