added some type checking
added additional sprite functionality
various changes