Refactor to allow arbitrary attributes hash