added balance corrections and refactored creating transactions