Made base path a static variable to avoid executing the full function on every call.