resize issues addressed, some refactoring