updated again for cleaner code