Working bankers algorithm. TODO: Documentation.
Fixed merge conflicts