Fixed a variety of issues