Finally combined some adjacent logic which was really bugging me, now code should be completely ready for the pull.