Refactor code to reduce redundancy between strict and non-strict classes