removed printStackTrace and replaced with logger or exception where appropriate