Some refactorings, API now support params