Cleanup and little refactor