fixed formatting
moved functions between libraries