Used asserts all around the code for better testing debug builds.