Finish unittest for logic and some minor patch to codes
Merge branch 'prototype' of github.com:longruiliu/ECR into prototype