More checks and fixed formatting
Updated tests