replaced ORM with raw sql calls