first interation of implementing quickEncode (currently not working properly)