Moved code from main repo