implement scale functionality (unstable version)