add proper logging, better param checks