refactoring and fancy rendering