Moved sheet controller code