Mostly Refactored. Check previous commits by date to see changes. more ot come
fixed