Refactoring and added block splitting functionality.
TODO: block merging when memory is freed.