Fix for #48

Rework of how services are sorted based on dependencies using a topological sort approach. 
Added tests for sort_service_dicts().

Let me know if this looks OK, or if more comments/tests are necessary! 
If it looks good, I can also removes the ```compat``` module (which is no longer required by the new approach).