added almost full funcionality