Extract theme-related code into a separate directory