refactored startup a bit