Fixed fixedclamp issues and made code neater