fixed some problems with design and logic