Fixed a bug (copy bigger source than dest)
Code cleanup