FIX: Code performance improvements. Specially in the getPrefix function