fixed bug and formatting