fixed logging and added exists method