Removed MTPair, fixed errors, added error handling to main, changed return types from MTPair to int[][];