Minor bug fixes. Algorithm now fully functional with any matrix size (either square or rectangular). Optimizations still to come.