Refactored CT Layer code