Added logging, error classes