Slightly cleaned up k.. not done though