Moved decompose function to separate header