Major refactor and more bugs..