refactor code and add stats for hibernate