Worked on the main spacesAvailable Method

This one is a very tricky method with a lot of maths. Did some test
cases for it as well. We'll need to check down the road that this works
correctly.