make this return reasonable errors
clean up system outs and replace with logging
add basic log4j configuration