Cleaned up bugs