Fixed up edge use cases and errors
Fixed warnings and whitespace