Refactor into new theme python file