Misc refactor,ing