Performance improvement and more functional approach