moved connect method to Api