Refactor site code