Fix code by PSR2
Added more asserts