cleaned up errors and increased stability