some bug fixes. Shited a lot of things to utils to use for future exchanges