implemented some of Marifel's suggestions