Add guard rspec
Tests and todos to fix complex functions