add O(1) ascii c median implementation. minor refactoring