Moved code to a sample