add checks and exceptions