Implementation of loader (very slow)