Removed some errorchecking code and normalized code style