Probably not the optimal solution, but now only creates a partition slightly larger than the amount of space used.
Added cleanup stuff.
Added more cleanup commands.
Clearing database entries.