Further refactoring. Add #3 and #5