renamed files and added singleton function