Made RAM mapping more generic