Fixed some injection issues. Added more logging functions.