Clean up code, add acyclic check as prototype

Add tests and remove unnecessary commands