working linux version

TODO: fix bug with tan
final linux version
merged master linux