Refactor rake files

Change-Id: Ib0b122a63c598be3a8c38e95e4960de609f81e81