cleaned up border code. transitions are still shaky