Moving some code and implement Lock Frame option

Moving some code and implement Lock Frame option