Some minor refactoring
Fix dialyzer warnings, relx support