some syntax fixes to reduce code complexity