refactored it further now.