Cleanup code and remove dependencies