added common functions
filtering scale directory is created and two main codes are added