Refactored tests to be more stable and faster