nanolib: restructured and added memcpy